/*
   Copyright (c) 2010, iUI Project Members
   See LICENSE.txt for licensing terms
 */
// requires HTML <canvas> support, but does *not* require SVG

iui.Extension('iui-canvg', {
  load: function() {
    console.log("onLoad: " + this);
    var aNode = this.querySelector("a[rel='iuicanvg']");
    if (aNode && !iui.hasClass(aNode, 'iuiloaded')) {
      var canvasNode = aNode.querySelector("canvas");
      if (canvasNode) {
        canvg(canvasNode, aNode.href, {ignoreMouse: true, ignoreAnimation: true});
        iui.addClass(aNode, 'iuiloaded');
      }
    }
  }
});
